package com.journey.org.ui.video.small

import android.os.Bundle
import com.journey.org.entity.V9LG4CHOR
import com.journey.org.ui.video.broadcast.BroadcastActivity
import com.mvvmhabit.org.base.ItemViewModel
import com.mvvmhabit.org.binding.command.BindingAction
import com.mvvmhabit.org.binding.command.BindingCommand

/**
 * @Date: 2020/11/19 16:52
 * @Author:小妖
 * @Description: 小视频
 */
class SmallVideoItemViewModel(vm: SmallVideoViewModel, val entity: V9LG4CHOR) :
    ItemViewModel<SmallVideoViewModel>(vm) {

    val onVideoStartCommand = BindingCommand<Any>(object : BindingAction {
        override fun call() {
            val bundle = Bundle()
            bundle.putString("url", entity.mp4_url)
            bundle.putString("type", "netease")
            bundle.putString("time", entity.ptime)
            bundle.putString("title", entity.title)
            bundle.putString("dec", entity.description)
            bundle.putString("content", entity.videosource + entity.topicName)
            viewModel.startActivity(BroadcastActivity::class.java, bundle)
            /* if (media != null) {
                 isVisibleField.set(false)
                 media?.start()
             }*/
        }
    })
}